package com.atguigu.exercise4;

/**
 * @author : leimingchao
 * @date Date : 2021年08月18日 21:03
 */
public class Bank {

    private Customer[] customers;
    private int numberOfCustomer;

    public Bank() {
        customers = new Customer[10];
    }

    public void addCustomer(String f, String l) {
        Customer customer = new Customer(f, l);
        // customers[numberOfCustomer] = customer;
        // numberOfCustomer++;
        customers[numberOfCustomer++] = customer;
    }

    public int getNumberOfCustomer() {
        return numberOfCustomer;
    }

    public Customer getCustomer(int index) {
        if (index >= 0 && index < numberOfCustomer) {
            return customers[index];
        }
        return null;
    }
}
